Repository navigation
fix(vcs): stop Check out here from discarding local pull request work - #15036
Conversation
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This PR changes production checkout behavior across Git workflows, provider adapters, and the web UI, including an autonomous tracked-change gate, lossless branch refresh, and shared concurrency leases. The focused tests are substantial, but the breadth and user-data-preservation impact require explicit validation of branch and provider compatibility. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
6feee5a to
0fc9753
Compare
Dismissing prior approval to re-evaluate 0fc9753
|
Replying to the CodeRabbit and Macroscope summaries after the latest push:
|
|
Replying to the refreshed bot summaries on the latest push:
|
|
Review requested
Logged so this PR shows when a maintainer was asked to review it. |
|
Review requested
Logged so this PR shows when a maintainer was asked to review it. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ead commit Narrow the local checkout fix to what the data-loss bug needs. Local checkout still refuses tracked edits and no longer forces the provider checkout, but whether the result is on the pull request's head is now read by comparing HEAD with the head commit the provider already reported, instead of fetching refs from a remote matched through SSH host resolution. - Drop the SSH alias/port-443 remote identity matching, the per-remote head fetch and `GitVcsDriver.resolveSshHostName`; the reused-worktree refresh goes back to main's behaviour. - GitLab, Bitbucket, Forgejo and Azure DevOps now pass through the head commit their reads already return, so a checkout on those hosts is not reported off-head just for lacking one. - Share the off-head warning from a small module, worded neutrally since a branch kept ahead is not older. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without `force`, Bitbucket, Forgejo and GitCafe check out an existing pull request branch as it was, so a branch behind the pull request stayed there. After the provider checkout, the branch now moves to the provider's head commit through the same clean, fast-forward-only refresh reused worktrees use; diverged or dirty checkouts stay put and report that they are not on the head. The warning now says the checkout could not be confirmed on the latest commit rather than asserting that its code differs, since a provider that reports no head commit also lands there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Narrowed and updated at 21683f2 (current main merged in). Against the triage on #14940:
On the review notes:
|
… discarding local pull request work Preserve the scoped contribution against upstream 70d60e0. Focused checks and read-only integration review recorded in the PR. GPT-6.1 Sol (high), Codex harness through T3 Code.
Dismissing prior approval to re-evaluate cb474b0
Use the existing workspace lease for the local checkout transaction and competing server branch operations. Canonicalize checkout roots consistently and guard the captured branch before refreshing. Verified with 165 focused tests, server typecheck, targeted lint/formatting and precommit. Frozen-tree review: GPT-6.1 Sol high, Codex through T3 Code.
Dismissing prior approval to re-evaluate 32855a9
|
Published the checkout concurrency repair in 32855a9d03. Another client's branch switch could run after the PR branch was captured and before its final fast-forward, causing the refresh to advance the newly selected branch. Local PR preparation now holds the existing workspace lease through refusal, checkout, upstream setup, branch guard and refresh. Switch, create-and-switch and feature-branch actions share that lease using the same canonical checkout-root policy, including projects rooted in subdirectories. External terminal Git and other server processes remain outside this process-local coordination. Verification: 165 focused GitManager/GitWorkflowService tests passed, server typecheck and targeted lint/formatting/precommit passed. Seven real-Git barrier cases cover independent workflows and alternate root spelling; the regression cases fail before their respective repairs. This is service-boundary proof, not a Windows or live two-socket UI run. Fresh read-only GPT-6.1 Sol high review through T3 completed with no actionable findings on the exact published tree. It was a same-model independent review because Claude quota is unavailable. The description now reflects the provider-head metadata implementation and current scope under the maintainer triage. Earlier UI evidence retains its recorded revision and limitations. New-head CI and bot review are pending. |
|
Taking over this one as maintainer for batch pull-request-13. I will preserve local work during checkout, merge current main, reduce the test surface, rebuild against current conventions, and run independent reviews. This will remain unmerged. |
…-pr-checkout-keep-local-work
Local pull-request checkout could discard tracked edits or unpublished commits, then report success even when the selected branch was not at the pull request head.
Local checkout now refuses staged or unstaged tracked edits before calling the provider, uses an unforced checkout, and only fast-forwards through the existing lossless refresh. Ahead and divergent commits are preserved. The result is checked against the provider head, and both web entry points show the same warning when that head cannot be confirmed. A canonical checkout-root lease serializes the local checkout with competing branch workflows in this server process. Worktree checkout retains its existing behavior.
Maintainer takeover of @saphid's #15036; original commits and author credit are preserved, with main merged rather than rewritten. The rebuild consolidates the lease in GitWorkflowService, removes duplicated GitManager checkout/root handling and the redundant symbolic-ref guard, and reuses the normalized Azure record type.
Verification
Client proof
Captured with the isolated Linux web app at a9a827897e, fresh worktree-owned state and a disposable clone. No agent turn was launched.
After: tracked edits are refused
After: unpublished commit is preserved and the client warns
Remaining limits
lastMergeSourceCommitcan lag a new push and produce a conservative warning; live timing verification remains useful. An unrelated untracked file can prevent the extra refresh on switch-only hosts, preserving the branch and file and returning the warning. External terminals and other server processes are outside the process-local lease.Tests: GPT-6-Astra; implementation: GPT-6.1-Sol; reviews: Claude Opus 5.5 and GPT-6-Sol. Work coordinated through T3 Code with the Codex harness (Claude harness for Opus review).